/**
 * 
 */
package matrices;

import problema.Utilidades;
import Jama.Matrix;

/**
 * @author Jose Antonio Gonzalez, Ambrin Chaudhary
 *
 */
public class pruebasSOM {

	
	public static double dist(Matrix m1, Matrix m2)
	{
		double s= 0;
		int n1 = m1.getColumnDimension();
		int n2 = m1.getRowDimension();
		if(n1 > n2)
		{
			double aux = 0;
			double[][] a1 = m1.getArray();
			double[][] a2 = m2.getArray();
			for (int i = 0; i< n1; i++)
			{
				double aux1 = a1[0][i] - a2[0][i];
				aux1 *= aux1;
				aux += aux1;
			}
			s = Math.sqrt(aux);
		}
		else
		{
			double aux = 0;
			double[][] a1 = m1.getArray();
			double[][] a2 = m2.getArray();
			for (int i = 0; i< n2; i++)
			{
				double aux1 = a1[i][0] - a2[i][0];
				aux1 *= aux1;
				aux += aux1;
			}
			s = Math.sqrt(aux);
		}
		
		return s;
	}
	
	
	static double alfaK( int k)
	{
		double s = 0;
		double kaux = k;
		s = Math.pow((alfaFin/alfaIni), (kaux/kMax));
		s *= alfaIni; 
		return s;
	}
	
	static double alfaIni = 1.0;
	static double alfaFin = 0.8;
	static int kMax =5;
	
	/**
	 * @param args
	 */
	public static void main(String[] args) 
	{
		
		double i = 1.0/5;
		System.out.println(i);
		System.out.println(Math.pow(0.8,i ));
		System.out.println(alfaK(1));
		double[][] d1 = {{1,3}};
		double[][] d2 = {{1,4}};
		Matrix c1 = new Matrix(d1);
		Matrix c2 = new Matrix(d2);
		System.out.println(Utilidades.dist(c1,c2));
		System.out.println(Utilidades.norma2alcuadrado(c1, c2));
		
	}

}
